package org.zl.mybatis.use.intercept;

import java.sql.Connection;

import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Signature;

@Intercepts({
	@Signature(type = StatementHandler.class,
			method = "prepare",
			args = {Connection.class, Integer.class}),
	
})
public class StatementHandlerInterceptor implements Interceptor {

	@Override
	public Object intercept(Invocation invocation) throws Throwable {
		System.out.println("\n-------4\n" + invocation);
		System.out.println(invocation.getTarget());
		System.out.println(invocation.getMethod());
		System.out.println(invocation.getArgs() + "\n-------");
		
		Object ret = invocation.proceed();
		return ret;
	}

}
